<template>
  <el-container>
    <!-- 左边菜单 -->
    <el-aside :width="isCollapse ? '64px' : '200px'">
      <div class="toggle-button">
        <span v-if="!isCollapse">商城管理系统</span>
      </div>
      <!-- 菜单列表组件 -->
      <Elmenu :menuList="menuList" ref="Elmenu"></Elmenu>
    </el-aside>

    <!-- 右边内容 -->
    <el-container>
      <!-- 头部 -->
      <el-header>
        <Header @toggleCollapse="toggleCollapse"></Header>
      </el-header>
      <!-- 内容 -->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>



<script>
import { removeToken } from '../utils/storage'
import Elmenu from '@/components/Elmenu/Elmenu.vue'
import Header from '@/components/Header/Header.vue'
export default {
  components: {
    Elmenu,
    Header
  },
  data() {
    return {
      //菜单列表
      menuList: [
        {
          id: 1,
          authName: "用户管理",
          icon: 'iconfont icon-yonghuguanli',
          path: '',
          children: [
            {
              id: 55,
              authName: "用户列表",
              path: '/userInfo',
              icon: "iconfont icon-liebiao",
              children: []
            }
          ]
        },
        {
          id: 2,
          authName: "商品管理",
          icon: 'iconfont icon-shangpinguanli',
          path: '',
          children: [
            {
              id: 10,
              authName: "分类管理",
              path: '/goodsClass',
              icon: "iconfont icon-liebiao",
              children: []
            },
            {
              id: 45,
              authName: "列表管理",
              path: '/goods',
              icon: "iconfont icon-liebiao",
              children: []
            }
          ]
        },
        {
          id: 3,
          authName: "订单管理",
          icon: 'iconfont icon-dingdanguanlixuanzhong',
          path: '',
          children: [
            {
              id: 11,
              authName: "订单列表",
              path: '/order',
              icon: "iconfont icon-liebiao",
              children: []
            }
          ]
        }

      ],
      //是否折叠
      isCollapse: false,
    }
  },
  methods: {

    //点击按钮，切换菜单的折叠与展开
    toggleCollapse() {
      this.$refs.Elmenu.isCollapse = !this.$refs.Elmenu.isCollapse
      this.isCollapse = !this.isCollapse
    },
  },


}
</script>

<style scoped lang="less">
.el-container {
  height: 100%;
  font-size: 14px;

  .el-aside {
    background-color: #FFFFFF;
    overflow: hidden;
    box-shadow: 10px 0px 10px 10px black;
    border-right: 1px solid #E7ECEE;

    .toggle-button {
      background-color: #FFFFFF;
      text-align: center;
      color: #333;
      list-style: 24px;
      letter-spacing: 0.2em;
      cursor: pointer;
      width: 100%;
      height: 40px;
      font-size: 17px;
      line-height: 40px;
      border-bottom: 1px solid #E7ECEE;
    }

    .el-menu {
      border: none;
    }
  }



  .el-container {

    .el-header {
      background-color: #EFF9FB;
      height: 60px;
    }

    .el-main {
      background-color: #fff;
    }
  }
}
</style>
